Skip to content

Conversation

@pvelesko
Copy link
Collaborator

  • SPVRegister: tolerate duplicate variable registration for identical (Ptr, Name) pairs
  • CHIPBackend: restore invariant in Device::getOrCreateModule, remove early null return
  • CHIPBindings: remove unreliable runtime fallback with address-range heuristics
  • HipGlobalVariables: maintain original COMDAT exclusion logic (reverted from initial approach)
  • TestTemplatedConstantMemcpy: add device-side validation kernel to verify actual data visibility

Fixes: #977

@pvelesko pvelesko marked this pull request as draft October 22, 2025 08:10
@pvelesko pvelesko force-pushed the fix-977 branch 2 times, most recently from 472bc6e to 5551551 Compare October 22, 2025 12:55
@pvelesko pvelesko added in-progress Work still in progress and removed in-progress Work still in progress labels Oct 31, 2025
@pvelesko pvelesko force-pushed the fix-977 branch 2 times, most recently from a156215 to 2ab1999 Compare December 16, 2025 02:10
- Introduced TestTemplatedConstantMemcpy.hip to reproduce Issue #977.
- The test verifies the behavior of hipMemcpyToSymbol with templated constant memory.
- Updated CMakeLists.txt to include the new test in the build process.
- SPVRegister: tolerate duplicate variable registration for identical (Ptr, Name) pairs
- CHIPBackend: restore invariant in Device::getOrCreateModule, remove early null return
- CHIPBindings: remove unreliable runtime fallback with address-range heuristics
- HipGlobalVariables: maintain original COMDAT exclusion logic (reverted from initial approach)
- TestTemplatedConstantMemcpy: add device-side validation kernel to verify actual data visibility

Fixes: #977
Replace malloc + placement new with std::unique_ptr for synthetic
SPVVariable objects created for device-only variables (e.g., templated
__constant__ variables). The static vector now stores unique_ptr which
ensures proper destruction of std::string members and memory deallocation
when the program exits.
@pvelesko pvelesko marked this pull request as ready for review January 14, 2026 09:41
- Replace malloc + placement new with unique_ptr for synthetic SPVVariable
  objects created for device-only variables (templated __constant__ vars)
- Add mutex protection around static SyntheticVars vector access
- Add duplicate check to prevent concurrent threads from creating same var
- Remove unreachable dead code in SPVRegister::bindVariable that checked
  for special abort/heap variables after already returning for same-name case
@pvelesko pvelesko merged commit 4c73877 into main Jan 14, 2026
22 checks passed
@pvelesko pvelesko deleted the fix-977 branch January 14, 2026 14:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

CHIP-SPV Error 13: hipMemcpyToSymbol with templated __constant__ memory fails

2 participants